home *** CD-ROM | disk | FTP | other *** search
-
- #include <proto/exec.h>
- #include <proto/dos.h>
- #include <proto/datatypes.h>
- #include <proto/muimaster.h>
- #include <clib/alib_protos.h>
- #include <mui/SpeedBar_mcc.h>
- #include <mui/SpeedBarCfg_mcc.h>
- #include <datatypes/pictureclass.h>
- #include <string.h>
- #include <stdio.h>
-
- /***********************************************************************/
-
- long __stack = 8192;
- struct Library *DataTypesBase;
- struct Library *MUIMasterBase;
-
- /***********************************************************************/
-
- #ifndef MAKE_ID
- #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
- #endif
-
- /***********************************************************************/
-
- struct MUIS_SpeedBar_Button buttons[] =
- {
- {0, "_Get", "Get the disc.", 0, NULL},
- {1, "Sa_ve", "Save the disc.", 0, NULL},
- {2, "_Stop", "Stop the connection.", 0, NULL},
- {MUIV_SpeedBar_Spacer},
- {3, "_Disc", "Disc page.", 0, NULL},
- {4, "_Matches", "Matches page.", 0, NULL},
- {5, "_Edit", "Edit page.", 0, NULL},
- {MUIV_SpeedBar_End},
- };
-
- STRPTR pics[] =
- {
- "PROGDIR:Pics/Get",
- "PROGDIR:Pics/Save",
- "PROGDIR:Pics/Stop",
- "PROGDIR:Pics/Disc",
- "PROGDIR:Pics/Matches",
- "PROGDIR:Pics/Edit",
- NULL
- };
-
- /***********************************************************************/
-
- static Object *
- loadDTBrush(struct MyBrush *brush,STRPTR file)
- {
- struct BitMapHeader *bmh;
- register Object *dto;
-
- if (!(dto = NewDTObject(file,DTA_GroupID,GID_PICTURE,PDTA_Remap,FALSE,PDTA_DestMode,PMODE_V42,TAG_DONE)) ||
- !(DoMethod(dto,DTM_PROCLAYOUT,NULL,1)) ||
- !(GetDTAttrs(dto,PDTA_DestBitMap,&brush->BitMap,PDTA_CRegs,&brush->Colors,PDTA_BitMapHeader,&bmh,TAG_DONE)==3))
- {
- if (dto)
- {
- DisposeDTObject(dto);
- dto = NULL;
- }
- }
- else
- {
- brush->Width = bmh->bmh_Width;
- brush->Height = bmh->bmh_Height;
- }
-
- return dto;
- }
-
- /***********************************************************************/
-
- #define TEMPLATE "STRIP,NUMBUTTON/N"
-
- int
- main(int argc,char **argv)
- {
- int res;
-
- if (DataTypesBase = OpenLibrary("datatypes.library",37))
- {
- if (MUIMasterBase = OpenLibrary("muimaster.library",19))
- {
- struct MyBrush brushes[sizeof(pics)/sizeof(STRPTR)-1], *b[sizeof(pics)/sizeof(STRPTR)-1];
- struct MUIS_SpeedBarCfg_Config c = {MUIV_SpeedBar_ViewMode_TextGfx, MUIV_SpeedBarCfg_Borderless|MUIV_SpeedBarCfg_Sunny};
- Object *dtos[sizeof(pics)/sizeof(STRPTR)-1], *app, *win, *sb;
- Object *cfg, *update;
- int i;
-
- for (i = 0; pics[i]; i++)
- {
- if (!(dtos[i] = loadDTBrush(brushes+i,pics[i])))
- {
- b[i] = NULL;
- printf("%s: warning can't load %s\n",argv[0],pics[i]);
- }
- else b[i] = brushes+i;
- }
-
- if (app = ApplicationObject,
- MUIA_Application_Title, "SpeedBar Demo4",
- MUIA_Application_Version, "$VER: SpeedBarDemo4 (6.2.2002)",
- MUIA_Application_Copyright, "Copyright 1999-2002 by Alfonso Ranieri",
- MUIA_Application_Author, "Alfonso Ranieri <alforan@tin.it>",
- MUIA_Application_Description, "Speed(Bar|Button|BarCfg).mcc test",
- MUIA_Application_Base, "SPEEDBARTEST",
- SubWindow, win = WindowObject,
- MUIA_Window_ID, MAKE_ID('M','A','I','N'),
- MUIA_Window_Title, "SpeedBar Demo4",
- WindowContents, VGroup,
- Child, HGroup,
- GroupFrame,
- Child, sb = SpeedBarObject,
- MUIA_Group_Horiz, TRUE,
- MUIA_SpeedBar_Borderless, TRUE,
- MUIA_SpeedBar_Sunny, TRUE,
- MUIA_SpeedBar_Buttons, buttons,
- MUIA_SpeedBar_StripUnderscore, TRUE,
- MUIA_SpeedBar_EnableUnderscore, TRUE,
- MUIA_SpeedBar_BarSpacer, TRUE,
- MUIA_SpeedBar_Images, b,
- End,
- Child, HSpace(0),
- End,
- Child, VSpace(0),
- Child, VGroup,
- GroupFrameT("Appareance"),
- Child, cfg = SpeedBarCfgObject,
- MUIA_SpeedBarCfg_Config, &c,
- End,
- Child, VSpace(0),
- Child, update = MUI_MakeObject(MUIO_Button,"_Update"),
- End,
- Child, VSpace(0),
- End,
- End,
- End)
- {
- ULONG sigs = 0, id;
-
- DoMethod(win,MUIM_Notify,MUIA_Window_CloseRequest,TRUE,MUIV_Notify_Application,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit);
- DoMethod(update,MUIM_Notify,MUIA_Pressed,FALSE,app,2,MUIM_Application_ReturnID,TAG_USER);
-
- set(win,MUIA_Window_Open,TRUE);
-
- while ((id = DoMethod(app,MUIM_Application_NewInput,&sigs))!=MUIV_Application_ReturnID_Quit)
- {
- if (id==TAG_USER)
- {
- struct MUIS_SpeedBarCfg_Config *c;
-
- get(cfg,MUIA_SpeedBarCfg_Config,&c);
-
- SetAttrs(sb,MUIA_SpeedBar_ViewMode,c->ViewMode,
- MUIA_SpeedBar_Borderless,c->Flags & MUIV_SpeedBarCfg_Borderless,
- MUIA_SpeedBar_RaisingFrame,c->Flags & MUIV_SpeedBarCfg_Raising,
- MUIA_SpeedBar_SmallImages,c->Flags & MUIV_SpeedBarCfg_SmallButtons,
- MUIA_SpeedBar_Sunny,c->Flags & MUIV_SpeedBarCfg_Sunny,
- TAG_DONE);
- }
-
- if (sigs)
- {
- sigs = Wait(sigs | SIGBREAKF_CTRL_C);
- if (sigs & SIGBREAKF_CTRL_C) break;
- }
- }
-
- MUI_DisposeObject(app);
-
- res = RETURN_OK;
- }
- else
- {
- printf("%s: can't create application\n",argv[0]);
- res = RETURN_FAIL;
- }
-
- for (i = 0; pics[i]; i++)
- if (dtos[i]) DisposeDTObject(dtos[i]);
-
- CloseLibrary(MUIMasterBase);
- }
- else
- {
- printf("%s: Can't open muimaster.library ver 19 or higher\n",argv[0]);
- res = RETURN_ERROR;
- }
-
- CloseLibrary(DataTypesBase);
- }
- else
- {
- printf("%s: can't open dtatypes.library ver 37 or higher\n",argv[0]);
- res = RETURN_ERROR;
- }
-
- return res;
- }
-
- /***********************************************************************/
-